﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using ZLCMS.Business.DwzFrame;
using ZLCMS.Data.Model;
using NHibernate;
using DotNet.Common.Command;

namespace ZLCMS.Web.SystemManage.Basics.Shop.TagInfo
{
    public partial class SetTagStatus : System.Web.UI.Page
    {
  protected FrameHelper _framePage;

        protected void Page_Load(object sender, EventArgs e)
        {
            //初始化DWZ控件
            _framePage = new FrameHelper(this);

            //批量删除
            if (string.IsNullOrEmpty(Request["tid"]))
            {
                    using (ISession session = DotNet.Common.NHibernateUtil.SessionFactoryHelper.CreateSession())
                    {
                            try
                            {
                                ShopTagInfo tag = session.Get<ShopTagInfo>(int.Parse(Request["tid"]));
                                tag.Status = Request["status"];
                                session.Update(tag);
                                session.Flush();
                            }
                            catch (System.Exception ex)
                            {
                                _framePage.Alert(new ReturnCode() { statusCode = 300, message = "操作失败-"+ex.Message });
                            }
                    }
            }
            else
            {
                _framePage.Alert(new ReturnCode() { statusCode = 300, message = "操作失败-参数错误!" });
            }

            _framePage.Alert(new ReturnCode() { statusCode = 200, message = "操作成功!", navTabId = _framePage.NavTabId });
        }
    }
}